#ifndef TASK_H
#define TASK_H

#include <defs/export.h>
#include <defs/global.h>
#include <core/entityobject.h>

#include <QtCore>

namespace Opl
{
    namespace Core
    {

        O_PRIVATE_DECLARE(Task);
        class CORE_EXPORT Task : public EntityObject
        {
                Q_OBJECT
            public:
                Task(Task* parent = 0);
                virtual ~Task();

                virtual QString toString();
            public slots:

                void start();
                void stop();
                void terminate();

                void exec();
                void quit();

                static void sleep(unsigned long seconds);
                static void msleep(unsigned long milliseconds);
            signals:
                void done();

            protected:
                bool quitNow();
                virtual void run() = 0;

            private:
                O_PRIVATE_DECLARE_MEMBER(Task)
        };


    }
}

#endif // TASK_H

